package com.tencent.mapper;

import com.tencent.entity.CheckGroup;
import com.tencent.entity.SetMeal;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

public interface SetMealMapper {
    /**
     * 新增套餐
     * @param setMeal
     * @return
     */
//     @Insert("insert into t_setmeal values (#{name},#{code},#{helpCode},#{sex},#{age},#{price},#{remark},#{attention})")
//     @Options(useGeneratedKeys = true, keyColumn = "id",keyProperty = "id")
    int add(SetMeal setMeal);

    /**
     * 查询所有套餐
     * @return
     * @param
     */
    @Select("select * from t_setmeal")
    public List<SetMeal> findAll();

    /**
     * 动态查询
     * @param code
     * @return
     */
    List<SetMeal> findByCode(String code);



    @Delete("delete from t_setmeal where code =#{code}")
    public int deleteByCode(String code);

    /**
     * 根据ID修改套餐信息
     */
    @Update("update t_setmeal set code = #{code} , name = #{name}, helpCode = #{helpCode}, sex = #{sex}, remark = #{remark}, attention = #{attention} where id=#{id}")
    int updateSetmeal(SetMeal setMeal);

    /**
     * 套餐根据id删除
     * @param id
     * @return
     */
    @Delete("delete from t_setmeal  where id = #{id}")
    public int deleteByid(String id);

    @Select("select * from t_setmeal where id = #{id}")
    public SetMeal findById(Integer id);

    @Select("select * from t_checkgroup")
    List<CheckGroup> findaddcheckGroup();


    //     @Insert("insert into t_setmeal_checkgroup values (#{setmeal_id},#{checkgroup_id})")
    public int insertsetmeal(Map<String,Integer> map);



    List<CheckGroup>findcheckgroupbyid(String id);


}
